﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ForecastList : System.Web.UI.Page
{
    protected List<Model.UsersAccount> userAccount = null;
    protected List<Model.NewsSite> tzlist = null;
    protected decimal winmonenyTotal, jiangjin2 = 0;
    protected int  totalCount = 0;
    protected List<Model.ForecastPost> forecastList , forecastNew = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int totalCount2 = 0;
            int totalcount = 0;
            tzlist = BLL.NewsSite.GetPageList_Where(0, 6, 5, out totalcount);
            userAccount = BLL.UsersAccount.getList(0, int.MaxValue, out totalCount2);
            foreach (Model.UsersAccount user in userAccount)
            {
                winmonenyTotal += user.winTotal;
            }
            jiangjin2 = Convert.ToDecimal(winmonenyTotal) / 100000000;
            BindData();
        }
    }
    private void BindData()
    {
        PagedDataSource pds = new PagedDataSource();
        string sql = "  PostType='" + Request["PostType"] + "' and LotteryType="+ Request["LotteryType"]+" and ";
        forecastList = BLL.ForecastPost.GetPageListBysql(this.AspNetPager1.CurrentPageIndex - 1, this.AspNetPager1.PageSize, sql + " 1=1 ", out totalCount);
        if (forecastList != null && forecastList.Count > 0)
        {
            AspNetPager1.RecordCount = totalCount;
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        }
        forecastNew = BLL.ForecastPost.GetPageListBysql(0, 6, "", out totalCount);
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindData();
    }
    public string SelectName(object Uid)
    {
        Model.CMember cm = BLL.CMember.GetModel(Convert.ToInt32(Uid));
        if (cm != null)
        {
            return cm.nickname;//用户真实姓名
        }
        else
        {
            return "***";
        }
    }
}